package com.psg.service.impl;

import com.psg.dao.UserDao;
import com.psg.pojo.User;
import com.psg.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class UserServiceImpl implements UserService  {
    @Autowired
    private UserDao userDao;

    @Override
    public User login(String uName, String pwd) {
        User user = userDao.findByUserName(uName);
        if(user != null && user.getPwd().equals((pwd))){
            return user;
        }
        return null;
    }

    @Override
    public Boolean register( String uName, String pwd, String email) {
        Boolean flag=userDao.register(uName,pwd,email);
        if (flag) {
            System.out.println("注册成功");
        }
        return flag;
    }





}
